<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>历史记录</title>
    <link rel="stylesheet" type="text/css" media="screen"
          href="${pageContext.request.contextPath}/resources/css/bootstrap.min.css">
</head>
<body>

<div class="container">
    <div class="row" style="margin-top: 40px">
        <div class="col-md-8 col-md-offset-2 ">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <span>历史借阅记录</span>
                </div>

                <table class="table table-bordered table-hover text-center">
                    <thead>
                    <tr class="info">
                        <td>编号</td>
                        <td>书名</td>
                        <td>状态</td>
                        <td>位置</td>
                        <td>操作</td>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach var="bah" items="${BAHList}">
                        <tr>
                            <td>${bah.id}</td>
                            <td>${bah.name}</td>
                            <td>
                                <c:choose>
                                    <c:when test="${bah.status == 0}">
                                        未借出
                                    </c:when>
                                    <c:when test="${bah.status == 1}">
                                        已借出
                                    </c:when>
                                </c:choose>
                            </td>
                            <td>${bah.position}</td>
                            <td>
                                <c:choose>
                                    <c:when test="${bah != null}">
                                        <button onclick="window.location.href=`${pageContext.request.contextPath}/book/borrow?id=${bah.id}`">
                                            借阅
                                        </button>
                                        <button onclick="window.location.href=`${pageContext.request.contextPath}/book/back?id=${bah.id}`">
                                            归还
                                        </button>
                                    </c:when>
                                </c:choose>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>

            </div>
        </div>

    </div>

</div>
</body>
<script>
</script>
</html>